package com.ddh.service.controller;

import com.ddh.service.common.Result;
import com.ddh.service.domain.player.dto.PlayerDTO;
import com.ddh.service.domain.player.vo.PlayerVO;
import com.ddh.service.service.PlayersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 11
 * @Description
 * @Date 2025/1/15  16:54
 */
@RestController
@RequestMapping("/player")
@Api(tags = "玩家账号")
public class PlayerController {

    @Resource
    private PlayersService playerService;

    @ApiOperation("玩家登录")
    @PostMapping("/login")
    public Result<PlayerVO> login(@RequestBody PlayerDTO playerDTO){
        PlayerVO playerVO=playerService.login(playerDTO);
        return Result.success(playerVO);
    }

    @ApiOperation("玩家注册")
    @PostMapping("/register")
    public Result<Boolean> register(@RequestBody PlayerDTO playerDTO){
        Boolean result=playerService.register(playerDTO);
        return Result.success(result);
    }

}
